home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group03a.txt
/
000045_icon-group-sender_Tue Mar 25 17:16:41 2003.msg
< prev
next >
Wrap
Internet Message Format
|
2003-12-22
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2Q0GRI19505
for icon-group-addresses; Tue, 25 Mar 2003 17:16:27 -0700 (MST)
Message-Id: <200303260016.h2Q0GRI19505@baskerville.CS.Arizona.EDU>
From: ernobe <ernobe@yahoo.com>
X-Newsgroups: comp.lang.icon
Subject: Re: newbie question -- ressurected
Date: Tue, 25 Mar 2003 14:29:39 -0600
User-Agent: Noworyta News Reader/2.9
To: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Quiet Voice wrote:
> Greetings:
>
> Several years ago, I made a brief foray into trying to teach myself
> the ICON programming language and develop some text analysis software.
> After several fits-n-starts, the project sort of died on the vine.
>
> I'm back at it again. Now, I'm trying to dig thru past code, remind
> myself of what it was supposed to do and how...and shake out the
> kinks.
>
> I ran a piece of code this morning and discovered that it results in
> an infinite loop.....but I can't figure out why.
>
> here is the code fragment:
>
> while not((line := read(data)) == "") do every
> write(lettercount[!line] +:= 1)
>
> {Note, this is one continuous line in the actual code}
> "data" is an input text file
>
> From some debugging I've done, it seems like it keep reading from the
> file after it reaches the end...it just loops back to the begining of
> the file and starts over again. But I don't figure out why.
>
> What am I missing?
>
According the Icon Language Reference, read( f ) "Produces the next line
from f, but fails on end of file."
Therefore, when the read function fails at the end of the data file,
a new assignment is not made to the line variable, the not function
succeeds once again, and an infinite loop ensues.
--
my esoteric links:
http://www.costarricense.cr/pagina/ernobe
take my quiz:
http://www.quizyourfriends.com/yourquiz.php?quizname=030320115851-ernobe